package com.umakr.ax.app.web;

import com.umakr.ax.common.service.UserScoreService;
import com.umakr.ax.core.base.AbstractController;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * <p>
 * 积分  前端控制器
 * </p>
 *
 * @author Umakr-Code-Generator
 * @since 2017-12-30
 */
@Controller
@RequestMapping("/api/userScore")
public class UserScoreAppController extends AbstractController {


	@Autowired
	UserScoreService userScoreService;

	/**
	 * 查询我关注的每个电台积分总和列表
	 * @param modelMap
	 * @param userId
     * @return
     */
	@ApiOperation(value = "获取积分总和列表")
	@GetMapping("/listRsScoreByUserId")
	public Object listRsScoreByUserId(ModelMap modelMap, Long userId ) {
		return setSuccessModelMap(modelMap,userScoreService.listRsScoreByUserId(userId));
	}

	/**
	 * 获取单个电台积分列表
	 * @param modelMap
	 * @param rsId
	 * @return
	 */
	@ApiOperation(value = "获取电台积分详情列表")
	@GetMapping("/listScoreByRsId")
	public Object listScoreByRsId(ModelMap modelMap, Long rsId ) {
		return setSuccessModelMap(modelMap,userScoreService.listScoreByRsId(rsId));
	}

	/**
	 * 获取单个电台积分列表
	 * @param modelMap
	 * @param rsId
	 * @return
	 */
	@ApiOperation(value = "获取电台积分详情列表")
	@GetMapping("/listScoreByRsIdAndUserId")
	public Object listScoreByRsIdAndUserId(ModelMap modelMap, Long rsId ,Long userId) {
		return setSuccessModelMap(modelMap,userScoreService.listScoreByRsIdAndUserId(rsId,userId));
	}

	@ApiOperation(value = "测试自动积分")
	@GetMapping("/testAutoAddUpScore")
	public Object testAutoAddUpScore(ModelMap modelMap, Long userId,Long rsId,Integer scoreType) {
		return setSuccessModelMap(modelMap,userScoreService.autoAddUpScore(userId,rsId,scoreType));
	}

}